﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<HuynhQuangWebsite.Models.ContactListViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Liên hệ với chúng tôi: Cty TNHH Huỳnh Quang
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    

    <section id="subheader">
		<div class="inner">
			<div class="subtitle">
				<h2>Liên hệ với chúng tôi</h2>
			</div>
			<div class="subdesc">
				<p><%if(Model!=null){%><%=Model.ContactUs.ContactTitle%><%} %></p>
			</div>
		</div>
	</section>
	<!-- #subheader -->		
		
			<section class="pagemid">
				<div class="inner">
					
					<div id="main">
						<div class="entry-content">
							
							<div class="one_half">
							
								<img src="../../Images/google_map.gif" alt="map" />
								
								<div class="divider_space"></div>
								
								<h3>Hướng dẫn</h3>
								<p><%if(Model!=null){ %><%=Model.ContactUs.ContactDirection %><%} %></p>						
							
								<h3>Gửi Email cho chúng tôi</h3>
								<div id="result"></div>
								<div class="sysform">
									<% using (Html.BeginForm("SendMail","Lien_he",FormMethod.Post,new { enctype = "multipart/form-data",@class="form",id="validate" })){%>

										<p class="name">
										    <%=Html.TextBox("txtName", "", new { @class = "validate[required]", id = "req" })%>	
										    <label for="name">Tên</label>
										</p>

										<p class="email">
										    <%=Html.TextBox("txtEmail", "", new { @class = "validate[required]", id = "req" })%>
                                            <label for="email">E-mail</label>
										</p>

										<p class="web">
                                            <%=Html.TextBox("txtPhone", "", new { @class = "validate[required]", id = "req" })%>	
											<label for="web">Điện thoại</label>
										</p>

										<p class="text">
										  <%=Html.TextArea("txtaContent", "", new { @class = "validate[required]", id = "req" })%> 
										</p>
                                            
										<p class="submit">
											<button type="submit" value="Send" class="button small blue" /><span>CHUYỂN</span>
										</p>

									<%} %>
								</div>
							
							</div>
							
							<div class="one_fourth">
								
								<h3>Hãy viết cho chúng tối</h3>
								<p><%=Model.ContactUs.ContactWriteToUs %></p>
								
								<%--<h3>Get Social</h3>
								<p>Suspendisse sit amet augue ante, mattis mattis metus. Nam nisi libero, auctor id mattis nec, pharetra ut nisi. Etiam ut dui vitae urna congue vulputate luctus sit amet nunc. Aliquam erat volutpat. Vivamus eleifend</p>							--%>
							
							</div>
							
							<div class="one_fourth last">
								
								<h3>Thông tin chung</h3>
								<p><%=Model.ContactUs.ContactGeneral%></p>

								<div class="divider_line"></div>
								
								<p><strong>Địa chỉ công ty</strong></p>
								<%if (Model != null)
                                 { %>
                                <p><strong>
									<%=Model.ContactUs.ContactAddr%><br/>
									<%=Model.ContactUs.ContactAddCity%>-
                                    <%=Model.ContactUs.ContactCountry%><br/>
								</strong>
								</p>
                                <strong>
								<span class="icon-print"><%=Model.ContactUs.ContactFax%></span>
								<span class="icon-phone"><%=Model.ContactUs.ContactPhone1%></span>
								<span class="icon-phone"><%=Model.ContactUs.ContactMobile%></span>
                                </strong>
							    <%} %>
							</div>

						</div>
						<!-- .entry-content -->
					</div>
					<!-- #main -->

				</div>
				<!-- .inner -->
			</section>
			<!-- .pagemid -->
            
              <script type="text/javascript">
                  $(function () {
                      $('#submit').click(CheckInput);
                  }
                  );
                  $(function () {
                      $("#txtName").focusout(CheckName);
                  });
                  $(function () {
                      $("#txtEmail").focusout(CheckEmail);
                  });
                  $(function () {
                      $('#txtaContent').focusout(CheckContent);
                  });

                  function CheckName() {
                      if ($('#txtName').val()==="") {
                          $('#dvName').css("visibility", "visible");
                          return false;
                      }
                      else {
                          $('#dvName').css("visibility", "hidden");
                          return true;
                      }
                  }


                  function CheckContent() {
                      if ($('#txtaContent').val()==="") {
                          $('#dvContent').css("visibility", "visible");
                          return false;
                      } else {
                          $('#dvContent').css("visibility", "hidden");
                          return true;
                      }
                  }

                  function CheckEmail() {
                      if ($('#txtEmail').val()===null) {
                          $('#dvEmail').css('visibility', 'visible');
                          return false;
                      } else {
                          var emailSyntax = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
                          var emailInput = $('#txtEmail').val();
                          if (emailSyntax.test(emailInput)) {
                              $('#dvEmail').css('visibility', 'hidden');
                              return true;
                          } else {
                              $('#dvEmail').css('visibility', 'visible');
                              return false;
                          }
                      }
                  }
                  function CheckInput() {
                      var valid = true;
                      if ($('#txtName').val()==="") {
                          $('#dvName').css("visibility", "visible");
                          valid = false;
                      }
                      else {
                          $('#dvName').css("visibility", "hidden");

                      }

                      if ($('#txtaContent').val()==="") {
                          $('#dvContent').css("visibility", "visible");
                          valid = false;
                      } else {
                          $('#dvContent').css("visibility", "hidden");

                      }

                      if ($('#txtEmail').val()===null) {
                          $('#dvEmail').css('visibility', 'visible');
                          valid = false;
                      } else {
                          var emailSyntax = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
                          var emailInput = $('#txtEmail').val();
                          if (emailSyntax.test(emailInput)) {
                              $('#dvEmail').css('visibility', 'hidden');

                          } else {
                              $('#dvEmail').css('visibility', 'visible');
                              valid = false;
                          }

                          return valid;
                      }
                  }
                   
    </script>	
</asp:Content>
